define(["app", "angular", "services/BaseService"], function(app, angular) {
	
	var deps = ["$http", "BaseService"];
	
	function companyDetailResource($http, BaseService) {
        return initResource($http, BaseService.restfulUrl + "company/", BaseService.formHeader);
    }
	
	var postHeader = {
	        "Content-Type" : "application/x-www-form-urlencoded;charset=utf-8"
	};
	
	function initResource($http, preUrl,formHeader) {
        return {
        	queryCompanyByCode: function (companyCode) {
                return $http.get(preUrl + "queryCompanyByCode", {
                    params: {
                    	companyCode: companyCode
                    }
                });
            },
            queryAccountInfo: function (companyCode) {
                return $http.get(preUrl + "queryAccountInfo", {
                    params: {
                    	companyCode: companyCode
                    }
                });
            },
            queryConsumeDataLine: function (companyCode,currentYear,currentMonth) {
                return $http.get(preUrl + "queryConsumeDataLine", {
                    params: {
                    	companyCode: companyCode,
                    	currentYear: currentYear,
                    	currentMonth:currentMonth
                    }
                });
            },
            
            
            
            deleteUserAuthority: function (userId,authorityType,companyCode) {
            	return $http.post(preUrl + "deleteUserAuthority", {
    				userId : userId,
    				companyCode : companyCode,
    				authorityType : authorityType
    			}, {
    				headers : postHeader
    			});
            },
            /**
    		 * 设置任务权限 新增、删除
    		 * 
    		 * @param orgIds 组织ID
    		 * @param type 0 新增 1删除
    		 * @param time 双人通话时长
    		 * 
    		 * @returns {*|Object}
    		 */
            grantConferenceAuthority : function(userIds, type,companyCode) {
    			return $http.post(preUrl + "grantConferenceAuthority", {
    				userIds : angular.isArray(userIds) ? userIds : [userIds],
    				type : type,
    				companyCode:companyCode
    			}, {
    				headers : postHeader
    			});
    		}
        };
        
    }
	companyDetailResource.$inject = deps;
	app.lazy.factory("CompanyDetailResource", companyDetailResource);
});
